/*jslint node:true*/
/*global angular*/
'use strict';
var app = angular.module('myApp', []);
app.value('defaultInput', 5);
app.factory("MainService", function () {
    var factory = {};
    factory.multiply = function (a, b) {
        return a * b;
    };
    return factory;
});
app.service("CalcService", function (MainService) {
    this.square = function (a) {
        return MainService.multiply(a, a);
    };
});

app.service("CalcService2", function (MainService2) {
    this.square = function (a) {
        return MainService2.multiply(a, a);
    };
});
app.config(function ($provide) {
    $provide.provider("MainService2", function () {
        this.$get = function () {
            var factory = {};
            factory.multiply = function (a, b) {
                return a * b;
            };
            return factory;
        };
    });
});
app.controller('myCtrl', function ($scope, CalcService, defaultInput) {
    $scope.number = defaultInput;
    $scope.result = CalcService.square($scope.number);
    $scope.square = function () {
        $scope.result = CalcService.square($scope.number);
    };
});

app.controller('myCtrl2', function ($scope, CalcService2, defaultInput) {
    $scope.number = defaultInput;
    $scope.result = CalcService2.square($scope.number);
    $scope.square = function () {
        $scope.result = CalcService2.square($scope.number);
    };
});
